/**
 * Created by camiez on 2017/4/3.
 */
'use strict';
const db = {};
const mysql = require('mysql');
var pool  = mysql.createPool({
    connectionLimit : 10,
    host            : 'localhost',
    port            : 3309,
    user            : 'root',
    password        : 'root',
    database        : 'book'
});
//封装自己的query
db.query = function(sql,params,callback){
    pool.query(sql,params, function (error, results, fields) {
        if (error) throw error;
        callback(results);
    });
}


module.exports = db;